const {baseURL}=require('./env').prod
const vip="wcx2001"

module.exports={
    request:function(url,method='GET',data={},isSumDomain=true) {
      //判断是否加vip个性域名
       if(isSumDomain) {
        url=`${baseURL}/${vip}/${url}`
       }else {
        url=`${baseURL}/${url}`
       }
  
       //进入loading
       wx.showLoading({
         title: '拼命加载中······',
       })
        
  
       return new Promise((resolve,reject)=>{
  
          wx.request({
            url,
            method,
            data,
            header:{
              'content-type':'application/x-www-form-urlencoded'
            },
            success(res) {
              wx.hideLoading()
              resolve(res.data)
            },
            fail(error) {
              reject(error)
            }
          })
       })
    },
  }